package com.ruoyi.basedata.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.basedata.domain.BdWdtwarehouseconfig;
import com.ruoyi.basedata.service.IBdWdtwarehouseconfigService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 电商仓库Controller
 * 
 * @author ptt
 * @date 2024-12-03
 */
@RestController
@RequestMapping("/settlementCenter/basedata/wdtwarehouseconfig")
public class BdWdtwarehouseconfigController extends BaseController
{
    @Autowired
    private IBdWdtwarehouseconfigService bdWdtwarehouseconfigService;

    /**
     * 查询电商仓库列表
     */
    @PreAuthorize("@ss.hasPermi('settlementCenter/basedata:wdtwarehouseconfig:list')")
    @GetMapping("/list")
    public TableDataInfo list(BdWdtwarehouseconfig bdWdtwarehouseconfig)
    {
        startPage();
        List<BdWdtwarehouseconfig> list = bdWdtwarehouseconfigService.selectBdWdtwarehouseconfigList(bdWdtwarehouseconfig);
        return getDataTable(list);
    }

    /**
     * 导出电商仓库列表
     */
    @PreAuthorize("@ss.hasPermi('settlementCenter/basedata:wdtwarehouseconfig:export')")
    @Log(title = "电商仓库", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, BdWdtwarehouseconfig bdWdtwarehouseconfig)
    {
        List<BdWdtwarehouseconfig> list = bdWdtwarehouseconfigService.selectBdWdtwarehouseconfigList(bdWdtwarehouseconfig);
        ExcelUtil<BdWdtwarehouseconfig> util = new ExcelUtil<BdWdtwarehouseconfig>(BdWdtwarehouseconfig.class);
        util.exportExcel(response, list, "电商仓库数据");
    }

    /**
     * 获取电商仓库详细信息
     */
    @PreAuthorize("@ss.hasPermi('settlementCenter/basedata:wdtwarehouseconfig:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(bdWdtwarehouseconfigService.selectBdWdtwarehouseconfigById(id));
    }

    /**
     * 新增电商仓库
     */
    @PreAuthorize("@ss.hasPermi('settlementCenter/basedata:wdtwarehouseconfig:add')")
    @Log(title = "电商仓库", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody BdWdtwarehouseconfig bdWdtwarehouseconfig)
    {
        return toAjax(bdWdtwarehouseconfigService.insertBdWdtwarehouseconfig(bdWdtwarehouseconfig));
    }

    /**
     * 修改电商仓库
     */
    @PreAuthorize("@ss.hasPermi('settlementCenter/basedata:wdtwarehouseconfig:edit')")
    @Log(title = "电商仓库", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody BdWdtwarehouseconfig bdWdtwarehouseconfig)
    {
        return toAjax(bdWdtwarehouseconfigService.updateBdWdtwarehouseconfig(bdWdtwarehouseconfig));
    }

    /**
     * 删除电商仓库
     */
    @PreAuthorize("@ss.hasPermi('settlementCenter/basedata:wdtwarehouseconfig:remove')")
    @Log(title = "电商仓库", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(bdWdtwarehouseconfigService.deleteBdWdtwarehouseconfigByIds(ids));
    }
}
